// Angular Version 6 below need to be deleted {providedIn: 'root'}

// angular
import {Injectable} from '@angular/core';
import {HttpParams} from '@angular/common/http';
// owner
import {Request} from 'pengesoft-ng-lib';
// models
// import {any[]} from '../domains/any[].domain';
import {Resume} from '../domains/resume.domain';

/**
 * ResumeMgeSvr
 */
@Injectable({
  providedIn: 'root'
})
export class ResumeMgeSvr {
  baseUrl: string;

  constructor(
    private request: Request
  ){
    this.baseUrl = 'ResumeMgeSvr.assx/';
  }

  /**
   *
   */
  GetVersion(): Promise<string>{
    const httpParams = new HttpParams();
    return this.request.post<string>(this.baseUrl + 'GetVersion', httpParams).then((res) => {
      return res;
    });
  }

  /**
   *
   */
  addResume(resume: Resume): Promise<number>{
    const httpParams = new HttpParams()
      .append('resume', resume.toString());
    return this.request.post<number>(this.baseUrl + 'addResume', httpParams).then((res) => {
      return res;
    });
  }

  /**
   *
   */
  updateResume(resume: Resume): Promise<number>{
    const httpParams = new HttpParams()
      .append('resume', resume.toString());
    return this.request.post<number>(this.baseUrl + 'updateResume', httpParams).then((res) => {
      return res;
    });
  }

  /**
   *
   */
  getDetailList(resume: Resume): Promise<any[]>{
    const httpParams = new HttpParams()
      .append('resume', resume.toString());
    return this.request.post<any[]>(this.baseUrl + 'getDetailList', httpParams).then((res) => {
      return res;
    });
  }
}

export class ResumeMgeSvrService {
}
